package com.xinhe.web.entity;

import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;
import java.math.BigDecimal;
import java.util.Date;

@Data
@Entity
@NoArgsConstructor
@AllArgsConstructor
@ApiModel(description = "商品订单表，和商品订单项详情表是一对多")
@Table(name = "tb_order")
public class Order {
    @Id
    @ApiModelProperty("id")
    private Long id;
    @ApiModelProperty("会员id")
    private Long userId;
    @ApiModelProperty("门店id(当类型为自提才有值)")
    private Long shopId;
    @ApiModelProperty("商家会员id")
    private Long sellerUserId;
    @ApiModelProperty("优惠劵id")
    private Long couponMemberId;
    @ApiModelProperty("订单编码")
    private String code;
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    @ApiModelProperty("订单支付时间")
    private Date payTime;
    @ApiModelProperty("订单总费用")
    private BigDecimal orderFee = BigDecimal.ZERO;
    @ApiModelProperty("订单支付费用")
    private BigDecimal orderPayFee = BigDecimal.ZERO;

    @ApiModelProperty("商品总费用")
    private BigDecimal goodsFee = BigDecimal.ZERO;

    @ApiModelProperty("订单总运费")
    private BigDecimal freightFee = BigDecimal.ZERO;
    @ApiModelProperty("订单优惠费用")
    private BigDecimal preferentialFee = BigDecimal.ZERO;
    @ApiModelProperty("订单商品总数量")
    private Integer orderAmount = Integer.valueOf(0);

    @ApiModelProperty("订单类型  COMMON(\"普通订单\") SECKILL(\"秒杀订单\") EAM(\"拼团订单\")")
    private String type;

    @ApiModelProperty("订单状态 UN_PAY(\"待付款\"),\n" +
            "PAYED(\"待发货\"),\n" +
            "SENDED(\"待收货\"),\n" +
            "RECEIVED(\"待评价\"),\n" +
            "COMMENTED(\"评论完成\"),\n" +
            "AFTER_SALE_SERVICE(\"售后\"),\n" +
            "SERVICE_APPLY(\"申请售后\"),\n" +
            "SERVICE_SUCCESS(\"售后同意\"),\n" +
            "SERVICE_REJECT(\"售后拒绝\"),\n" +
            "CANCEL(\"已取消\"),\n" +
            "TIMEOUT(\"支付超时\"),\n" +
            "TEAMING(\"组团中\"),\n" +
            "SUCCESS(\"拼团成功\"),\n" +
            "FAILURE(\"拼团失败\");")
    private String status;

    @ApiModelProperty("订单配送类型  MAIL(快递配送) ONESELF_TAKE(门店自提) ")
    private String distributionType;

    @ApiModelProperty("买家备注")
    private String buyerRemark;

    @ApiModelProperty("买家提醒发货（0,1）")
    private Integer remindSend = Integer.valueOf(0);

    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    @ApiModelProperty("买家提醒发货时间")
    private Date remindSendTime;

    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    @ApiModelProperty("发货时间")
    private Date sendTime;

    @ApiModelProperty("支付方式 YUNCHASEED(\"云茶籽支付\"),\n" +
            "CONSUMERGOLDREDENVELOPE(\"消费金红包支付\"),\n" +
            "TEAOILCARD(\"茶油卡支付\"),\n" +
            "BALANCE(\"余额支付\"),\n" +
            "OFFLINE(\"线下支付\"),\n" +
            "WEIXIN_APP(\"微信APP支付\", EPayPlatform.WEIXIN),\n" +
            "WEIXIN_JSAPI(\"微信JSAPI支付\", EPayPlatform.WEIXIN);")
    private String payChannel;
    @ApiModelProperty("运营管理费")
    private BigDecimal opexManagerFee = BigDecimal.ZERO;

    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    @ApiModelProperty("订单签收时间")
    private Date receiveTime;

}
